package com.twu.biblioteca;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Joe
 * Date: 25/06/13
 * Time: 4:05 PM
 * To change this template use File | Settings | File Templates.
 */
public class Reservation {

    public enum ReservationType{
        BOOK;
    }

    public int mediaID;
    public String who;
    public ReservationType type;

    public Reservation(int bookId, String whosReservation, ReservationType type) {
        this.mediaID = bookId;
        this.who = whosReservation;
        this.type = type;
    }

    public static boolean isItemAvailable(List<Reservation> reservations, int bookID, ReservationType type){
        for(Reservation r: reservations){
            if (r.type == type){
                if(r.mediaID == bookID)
                    return false;
            }
        }
        return true;
    }
}
